package com.hundsun.yr.universal.p2p.bean;

import java.io.Serializable;

import com.hundsun.yr.universal.library.utils.HsNumberUtils;
import com.hundsun.yr.universal.library.utils.MathUtils;







/**   
* @Title: CalendarReturn.java 
* @Package com.hundsun.yr.universal.p2p.bean 
* @Description: TODO(用一句话描述该文件做什么) 
* @author shenhejun  
* @date 2016-9-8 上午9:55:36 
* @version V1.0   
*/
public class CalendarReturn extends ResponseBean implements Serializable {
	
	private static final long serialVersionUID = 1L;

	/**
	 * 产品名称
	 */
	private String prdName;
	/**
	 * 金额 
	 */
	private String amount;
	/**
	 * 利率
	 */
	private String yield;
	/**
	 * 投资期限
	 */
	private String term;
	/**
	 * 开始日期
	 */
	private String startDate;
	/**
	 * 到期日期
	 */
	private String endDate;
	/**
	 * 产品状态码0-未发布\",\"1-投标中\",\"2-计息中\",\"3-待返还\",\"4-已返还\",\"5-已结束\",\"6-已撤销
	 */
	private String status;
	public String getPrdName() {
		return prdName;
	}
	public void setPrdName(String prdName) {
		this.prdName = prdName;
	}
	public String getAmount() {
		return amount;
	}
	public void setAmount(String amount) {
		this.amount = amount;
	}
	public String getYield() {
		return yield;
	}
	public void setYield(String yield) {
		this.yield = yield;
	}
	public String getTerm() {
		return term;
	}
	public void setTerm(String term) {
		this.term = term;
	}
	public String getStartDate() {
		return startDate;
	}
	public void setStartDate(String startDate) {
		this.startDate = startDate;
	}
	public String getEndDate() {
		return endDate;
	}
	public void setEndDate(String endDate) {
		this.endDate = endDate;
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	
	
	/**
	 * yyyy/MM
	 * @return
	 */
	public String getYearMonth() {
		
		try {
			String date=endDate.substring(0, 6);
			return date;
		} catch (Exception e) {
			// TODO: handle exception
			return "";
		}
	}
	
	
	/**
	 * mm-dd
	 * @return
	 */
	public String getMonthDay() {
		
		try {
			String month=endDate.substring(4, 6);
			String day=endDate.substring(6, 8);
			return month+"-"+day;
		} catch (Exception e) {
			// TODO: handle exception
			return "";
		}
	}
	
	
	/**
	 * yyyy
	 * @return
	 */
	public int getYear() {
		
		try {
			String year=endDate.substring(0, 4);
			return Integer.parseInt(year);
		} catch (Exception e) {
			// TODO: handle exception
			return -1;
		}
	}
	
	
	
	/**
	 * mm
	 * @return
	 */
	public int getMonth() {
		
		try {
			String month=endDate.substring(4, 6);
			return Integer.parseInt(month)-1;
		} catch (Exception e) {
			// TODO: handle exception
			return -1;
		}
	}
	
	
	/**
	 * dd
	 * @return
	 */
	public int getDay() {
		try {
			String day=endDate.substring(6, 8);
			return Integer.parseInt(day)-1;
		} catch (Exception e) {
			// TODO: handle exception
			return -1;
		}
	}
	
	/**
	 * 获取利息
	 * @return
	 */
	public String getFee(){//利息＝本金＊利率＊投资期限/360

		String fee=HsNumberUtils.numberFormat("##0.00",MathUtils.division(MathUtils.multiply(amount,yield,term), "36000"));
		
		return fee;
	}
	
	
	/**
	 * 获取利息
	 * @return
	 */
	public String getTotleAmount(){//利息＝本金＊利率＊投资期限/360

		
		String totleAmount=HsNumberUtils.numberFormat("##0.00",MathUtils.plus(MathUtils.division(MathUtils.multiply(amount,yield,term), "36000"),amount));
		
		return totleAmount;
	}
	
	/**
	 * 获取利息
	 * @return
	 */
	public String getTotleAmountSimple(){//利息＝本金＊利率＊投资期限/360

		
		String totleAmount=MathUtils.plus(MathUtils.division(MathUtils.multiply(amount,yield,term), "36000"),amount);
		
		return totleAmount;
	}
	
	/**
	 * 显示到期日
	 * @return
	 */
	public String dispalyEndDate(){
		try {
			String year=endDate.substring(0, 4);
			String month=endDate.substring(4, 6);
			String day=endDate.substring(6, 8);
			return year+"-"+month+"-"+day;
		} catch (Exception e) {
			// TODO: handle exception
			return "";
		}
	}
	
}
